package mynews.com.kty.mynews.adapter;

import android.support.annotation.LayoutRes;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

import mynews.com.kty.mynews.R;
import mynews.com.kty.mynews.bean.News;

/**
 * TODO:
 * Created by 倪彬彬 on 2017/3/14.
 */
public class NewsViewHolder extends BaseViewHolder<News> {

    private TextView mTv_name;
    private ImageView mImg_face;
    private TextView mTv_sign;

    public NewsViewHolder(ViewGroup parent) {
        super(parent, R.layout.news_recycler_item);
        //必须写$否则会报空指针
        mTv_name = $(R.id.person_name);
        mImg_face = $(R.id.person_face);
        mTv_sign = $(R.id.person_sign);
    }

    public void setData(final News news) {
        mTv_name.setText(news.getTitle());
        mTv_sign.setText(news.getCtime());
        Glide.with(getContext())
                .load(news.getPicUrl())
                .placeholder(R.mipmap.ic_launcher)
                .centerCrop()
                .into(mImg_face);

    }
}
